<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <input type="hidden" name="id" th:value="${id}" id="id"/>

        </div>

        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">

            <a class="btn btn-warning" onclick="$.table.exportExcel()" >

                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "system/merchantUpgrade";
    var datas = [[${@dict.getType('sys_merchant_upgrade_type')}]];
    var datas1 = [[${@dict.getType('sys_merchant_level')}]];
    function queryParams(params) {
        return {
            merchantId: $("#id").val(),
            pageSize: params.limit,
            pageNum: params.offset / params.limit + 1,
            searchValue: params.search,
            orderByColumn: params.sort,
            isAsc: params.order
        };
    }
    $(function () {
        var options = {
            url: prefix + "/list",
            exportUrl: prefix + "/export",
            modalName: "商户升级",
            queryParams: queryParams,
            sortName: "createTime",
            sortOrder: "desc",

            search: false,
            showExport: true,
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'phone',
                    title: '手机号码',
                    align: 'center',
                },
                {
                    field: 'merchantName',
                    title: '商户名称',
                    align: 'center',
                },
                {
                    field: 'level',
                    title: '升级等级',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(datas1, value);
                    }
                },
                {
                    field: 'type',
                    title: '升级类型',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'createTime',
                    title: '升级时间',
                    align: 'center',
                },

                ]
        };
        $.table.init(options);
    });
</script>
</body>
</html>